package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.GlCollectionDao;
import com.victor.dao.GlCommentsDao;
import com.victor.dao.GlPraiseDao;
import com.victor.dao.GlReplyDao;
import com.victor.dao.GlcommentsPhotoDao;
import com.victor.dao.GlcommentsPraiseDao;
import com.victor.dao.TourismglDao;
import com.victor.dao.TourismglXqDao;
import com.victor.dao.TourismgltuDao;
import com.victor.entity.GlCollection;
import com.victor.entity.GlComments;
import com.victor.entity.GlPraise;
import com.victor.entity.GlReply;
import com.victor.entity.GlcommentsPhoto;
import com.victor.entity.GlcommentsPraise;
import com.victor.entity.Tourismgl;
import com.victor.entity.TourismglXq;
import com.victor.entity.Tourismgltu;
import com.victor.service.TourismService;

@Service
public class TourismServiceImpl implements TourismService {
	@Autowired
	private TourismglDao tourismglDao;
	@Autowired
	private TourismglXqDao tourismglxqDao;
	@Autowired
	private TourismgltuDao tourismgltuDao;
	@Autowired
	private GlCollectionDao glcollectionDao;
	@Autowired
	private GlPraiseDao praiseDao;
	@Autowired
	private GlCommentsDao commentsDao;
	@Autowired
	private GlReplyDao replyDao;
	@Autowired
	private GlcommentsPhotoDao photoDao;
	@Autowired
	private GlcommentsPraiseDao commentspraiseDao;

	@Override
	public boolean insertTourism(Tourismgl tourismgl) {
		return tourismglDao.insertSelective(tourismgl);
	}

	@Override
	public boolean insertGongLve(TourismglXq tourismglXq) {
		return tourismglxqDao.insertSelective(tourismglXq);
	}

	@Override
	public boolean insertTuPian(Tourismgltu tourismgltu) {
		return tourismgltuDao.insertSelective(tourismgltu);
	}

	@Override
	public boolean updateTourism(Tourismgl tourismgl) {
		return tourismglDao.updateByPrimaryKeySelective(tourismgl);
	}

	@Override
	public boolean updateGongLve(TourismglXq tourismglXq) {
		return tourismglxqDao.updateByPrimaryKeySelective(tourismglXq);
	}

	@Override
	public Tourismgltu selPhotoById(Integer id) {
		return tourismgltuDao.selById(id);
	}

	@Override
	public boolean updatePhoto(Tourismgltu tourismgltu) {
		return tourismgltuDao.updateByPrimaryKeySelective(tourismgltu);
	}

	@Override
	public boolean delTourism(int[] ids) {
		return tourismglDao.deleteByPrimaryKey(ids);
	}

	@Override
	public List<Tourismgltu> selPhotoByGlid(int i) {
		return tourismgltuDao.selByGlid(i);
	}

	@Override
	public boolean delGongLve(int[] ids) {
		return tourismglxqDao.deleteByPrimaryKey(ids);
	}

	@Override
	public boolean delPhoto(int[] ids) {
		return tourismgltuDao.deleteByPrimaryKey(ids);
	}

	@Override
	public PageInfo<Tourismgl> selAll(int page, int row) {
		PageHelper.startPage(page, row);
		 List<Tourismgl> list = tourismglDao.selAll();
		return new PageInfo<>(list, 5);
	}

	@Override
	public Tourismgl selTourismById(int i) {
		return tourismglDao.selById(i);
	}

	@Override
	public Tourismgl selTourismByName(String name) {
		return tourismglDao.selByName(name);
	}

	@Override
	public List<Tourismgl> selAllNoPage() {
		return tourismglDao.selAll();
	}

	@Override
	public boolean addGlCollection(GlCollection glCollection) {
		return glcollectionDao.insertSelective(glCollection);
	}

	@Override
	public GlCollection selCollection(GlCollection glCollection) {
		return glcollectionDao.selByGlCollection(glCollection);
	}

	@Override
	public boolean delCollection(Integer id) {
		return glcollectionDao.deleteByPrimaryKey(id);
	}

	@Override
	public GlPraise selByGlpraise(GlPraise glPraise) {
		return praiseDao.selByGlpraise(glPraise);
	}

	@Override
	public boolean delPraise(Integer id) {
		return praiseDao.deleteByPrimaryKey(id);
	}

	@Override
	public boolean insertpraise(GlPraise glPraise) {
		return praiseDao.insertSelective(glPraise);
	}

	@Override
	public boolean insertComments(GlComments glComments) {
		return commentsDao.insertSelective(glComments);
	}

	@Override
	public boolean insertReply(GlReply glReply) {
		return replyDao.insertSelective(glReply);
	}

	@Override
	public boolean insertCommentsPhoto(GlcommentsPhoto glcommentsPhoto) {
		return photoDao.insertSelective(glcommentsPhoto);
	}

	@Override
	public GlcommentsPraise selCommentsPraise(GlcommentsPraise glcommentsPraise) {
		return commentspraiseDao.selBycommentspraise(glcommentsPraise);
	}

	@Override
	public boolean insertCommentsPraise(GlcommentsPraise glcommentsPraise) {
		return commentspraiseDao.insertSelective(glcommentsPraise);
	}

	@Override
	public boolean delCommentsPraise(Integer integer) {
		return commentspraiseDao.deleteByPrimaryKey(integer);
	}

	@Override
	public PageInfo<GlComments> selCommentsByGlid(String glid, int page, int row,String uid) {
		PageHelper.startPage(page, row);
		List<GlComments> list = commentsDao.selCommentsByGlid(glid,uid);
		return new PageInfo<>(list, 5);
	}

	@Override
	public Integer selPraiseCountByGcid(String gcid) {
		return commentspraiseDao.selPraiseCount(gcid);
	}

	@Override
	public List<Tourismgl> selByglass(int i,String city) {
		return tourismglDao.selByGlclass(i,city);
	}

	@Override
	public PageInfo<Tourismgl> selByGlClass(String glclass,int page,int row) {
		PageHelper.startPage(page, row);
		List<Tourismgl> list = tourismglDao.selByGlclassOnly(glclass);
		return new PageInfo<>(list, 5);
	}

	@Override
	public Tourismgl selGlByUidAndGlid(Integer glid, String uid) {
		return tourismglDao.selByUidAndGlid(glid,uid);
	}

	@Override
	public PageInfo<GlComments> selByGlid(String glid, int page, int row) {
		PageHelper.startPage(page, row);
		List<GlComments> list = commentsDao.selByGlid(glid);
		return new PageInfo<>(list, 5);
	}

}
